package com.yjh.common.utils;

import org.springframework.stereotype.Component;

import java.io.File;

@Component
public class FilePathUtil {

    public static String getProjectRootPath() {
        String userDir = System.getProperty("user.dir");
        return userDir;
    }

    public static String getAbsolutePath(String relativePath) {
        File absolutePath = new File(getProjectRootPath(), relativePath);
        if (!absolutePath.exists()) {
            absolutePath.mkdirs();
        }
        return absolutePath.getAbsolutePath();
    }
}